<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ include file="/common/init.jsp"%>
<html>
<head>
<title>澳斯浪廷会员平台</title>
<link href="<c:url value='/resources/css/css.css'/>" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="<c:url value='/resources/js/jquery-1.7.2.min.js'/>"></script>
<script type="text/javascript" src="<c:url value='/resources/js/validate.js'/>"></script>
</head>
<body leftmargin="0">
	<div class="main">
		<div class="width_l">
			<iframe src="menu.action" frameborder="0" width="250" height="100%" class="menu"></iframe>
		</div>
		<div class="right">
			<div class="width_r">
				<div class="menu_r">
					<ul>
						<li><a href="index.action">首页</a></li>
						<li><a href="information.action">消息</a></li>
						<li><a href="notice.action">公告中心</a></li>
						<li><a href="news.action">新闻中心</a></li>
						<li><a href="inbox.action">收件箱</a></li>
						<li><a href="tomail.action">写邮件</a></li>
						<li><a href="sent.action">已发送</a></li>
						<li><a href="${ctx}/exit.action">安全退出</a></li> 
					</ul>
				</div>
				<div class="news_top">
					<img src="<c:url value='/resources/images/top.jpg'/>" />
				</div>
				<div class="news">
					<h4>VV户口注册</h4>
					<form action="">
						<input type="hidden" name="registerType" id="registerType" value="myself"/>
					
					<table width="400" border="0" cellpadding="0" cellspacing="0"
						style="margin-left: 300px; line-height: 32px; margin-top: 10px; color: #676767;">
						<tr>
							<td width="75">会员账户：</td>
							<td width="142"><input name="user.userAccount" type="text" class="text" readonly="readonly"
								id="userAccount" size="16" value="${randStr}" /></td>
							<td width="183"><img
								src="<c:url value='/resources/images/huan.jpg'/>" width="46"
								height="24"  id="changeName"/></td>
						</tr>
						<tr>
							<td>安置人：</td>
							<td><input name="user.parentId" type="text" id="parentId" class="text" readonly="readonly"
								size="16" value="${user.parentId}"/>
								<input type="hidden" name="user.recommendId" id="recommendId" value="${user.userAccount }"/>
							</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>等级：</td>
							<td><select name="user.level">
									<c:forEach var="level" items="${levelList}">
									 	<option value="${level.code }">${level.name }</option>
									</c:forEach>
							</select></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>市场部门：</td>
							<td><select name="user.location" id="location">
									<c:forEach var="location" items="${locationList}">
										 	<option value="${location.code }" <c:if test="${location.code eq user.location}">selected="selected"</c:if>>${location.name }</option>
										</c:forEach>
							</select></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>推荐人：</td>
							<td> ${user.userAccount }</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>开户名：</td>
							<td>${userBank.bankUser}</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>开户行：</td>
							<td>${userBank.bankName}</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>省/市：</td>
							<td>${userBank.bankProvince }</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>分支行：</td>
							<td>${userBank.subBranch }</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td>银行帐号：</td>
							<td>${userBank.bankCard }</td>
							<td>&nbsp;</td>
						</tr>
					</table>
					</form>
					<%-- <div class="zc_zj">
						推荐人： ${user.userAccount }<br /> 姓名：${userBank.bankUser}<br /> 开户名：${userBank.bankUser}<br /> 开户行： ${userBank.bankName}<br />
						省/市： ${userBank.bankProvince }<br /> 分支行：${userBank.subBranch }<br /> 银行帐号：${userBank.bankCard }
					</div> --%>
					<div class="tijiao">
						<img src="<c:url value='/resources/images/tijiao.jpg'/>"  onclick="doSave();" id="myself"/>
					</div>
					<div class="news_down">
						<img src="<c:url value='/resources/images/down.jpg'/>" />
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">
<!--
$(function(){
	$("#changeName").click(function(){
		$.ajax({
			type: 'POST',
			url: "${ctx}/getaccount.action",
			dataType: "html",
			success: function(data,status){
				//alert(data);
				if($.trim(data)!=''){
					$("#userAccount").val(data);
				}
			},
			error: function(data,status,e){
				alert(e.name);
			}
		});
	});
});

function doSave(){
	$.ajaxSetup({cache:false});
	var checkFlg = true;
	//checkFlg = checkFlg && validateEmpty_jquery("推荐人", "recommendId");
	checkFlg = checkFlg && validateEmpty_jquery("安置人", "parentId"); //判断安置人是否已满 
	//checkFlg = checkFlg && false;
	$.ajax({
		type:'POST',
		url: "${ctx}/checkloc.action",
		data: "user.parentId="+$("#parentId").val()+"&user.location="+$("#location").val()+"&user.recommendId="+$("#recommendId").val(),
		dataType:"html",
        async:false,  // 设置同步方式
        cache:false,
		success: function(data,status){
			if($.trim(data)!=''){
				alert(data);
				checkFlg = checkFlg && false;
			}
		},
		error: function(data,status,e){
			alert(e.name);
		}
	});

	if ( !checkFlg ) return false;
    if (checkFlg) {
    	//var data = $("#othermember").formSerialize();
    	$("#myself").removeAttr("onclick");
    	document.forms[0].action = "${ctx}/saveMember.action";
        document.forms[0].submit();
    }
}
//-->
</script>
